package com.ubi.core.framework.datasource;

import org.apache.commons.dbcp.BasicDataSource;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.DisposableBean;

import java.sql.SQLFeatureNotSupportedException;
import java.util.logging.Logger;

public class ManagedDataSource extends BasicDataSource implements DisposableBean {

    final org.slf4j.Logger logger = LoggerFactory.getLogger(getClass());

    @Override
    public Logger getParentLogger() throws SQLFeatureNotSupportedException {
        throw new SQLFeatureNotSupportedException("not supported");
    }

    @Override
    public void destroy() throws Exception {
        logger.info("begin shutdown data source connection pool");
        close();
        logger.info("finish shutdown data source connection pool");
    }
}
